package com.linwen.javase.desgin_pattern.BigTalkDesignPattenJAVACode._03装饰模式._4装饰器基本代码;

import java.util.Optional;
import java.util.function.Consumer;

/**
 * @ClassName Decorator
 * @Description TODO
 * @Author zero
 * @DATE 2023/7/10 10:29 PM
 * @Version 1.0
 */
public abstract class Decorator extends Component{
    protected Component component;

    public void SetComponent(Component component) {
        this.component = component;
    }

    public void Operation() {
        Optional.ofNullable(this.component).ifPresent(Component::Operation);
    }

}
